package com.olclass.web.domain;

import java.io.Serializable;
import java.util.List;
import javax.persistence.*;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.springframework.core.annotation.Order;

@Entity
@Table(name = "lesson" )
public class Lesson  implements Serializable {

  private static final long serialVersionUID =  1031285023634070206L;

  @Id
  @GenericGenerator(name="idGenerator", strategy="uuid2")
  @GeneratedValue(generator="idGenerator")
  @Column(name = "id" )
  private String id;

  @Column(name = "name" )
  private String name;

  @Column(name = "description" )
  private String desc;

  @Column(name = "start" )
  private String start;

  @Column(name = "end" )
  private String end;

  @Column(name = "img" )
  private String img;

  @Column(name = "list" )
  private String list;

  @Column(name = "class" )
  private Integer classtime;

  @Column(name = "userid" )
  private String userid;

  @OneToMany(fetch=FetchType.EAGER)
  @OrderBy("date asc")
  @JoinColumn(name = "pid", insertable = false, updatable = false)
  @NotFound(action = NotFoundAction.IGNORE)
  private List<Lessonitem> lessonitems;

  public List<Lessonitem> getLessonitems() {
    return lessonitems;
  }

  public void setLessonitems(List<Lessonitem> lessonitems) {
    this.lessonitems = lessonitems;
  }

  public String getUserid() {
    return userid;
  }

  public void setUserid(String userid) {
    this.userid = userid;
  }

  public String getId() {
    return id;
  }

  public void setId(String id) {
    this.id = id;
  }
public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public String getDesc() {
    return desc;
  }

  public void setDesc(String desc) {
    this.desc = desc;
  }

  public String getStart() {
    return start;
  }

  public void setStart(String start) {
    this.start = start;
  }

  public String getEnd() {
    return end;
  }

  public void setEnd(String end) {
    this.end = end;
  }

  public String getImg() {
    return img;
  }

  public void setImg(String img) {
    this.img = img;
  }

  public String getList() {
    return list;
  }

  public void setList(String list) {
    this.list = list;
  }

  public Integer getClasstime() {
    return classtime;
  }

  public void setClasstime(Integer classtime) {
    this.classtime = classtime;
  }
}
